{{!
  Copyright IBM Corp. 2016, 2025
  SPDX-License-Identifier: BUSL-1.1
}}

<CheckboxGrid
  @name="key_usage"
  @label="Key usage"
  @subText="Specifies the default key usage constraint on the issued certificate. To specify no default key_usage constraints, uncheck every item in this list."
  @fields={{this.keyUsageFields}}
  @value={{@form.data.key_usage}}
  @onChange={{this.checkboxChange}}
  data-test-key-usage-key-usage-checkboxes
/>
<CheckboxGrid
  @name="ext_key_usage"
  @label="Extended key usage"
  @subText="Specifies the default key usage constraint on the issued certificate. To specify no default ext_key_usage constraints, uncheck every item in this list."
  @fields={{this.extKeyUsageFields}}
  @value={{@form.data.ext_key_usage}}
  @onChange={{this.checkboxChange}}
  class="has-top-margin-s"
  data-test-key-usage-ext-key-usage-checkboxes
/>
<div class="has-top-margin-xxl">
  <div class="has-bottom-margin-s">
    <FormFieldLabel
      for="Extended key usage flags"
      @label="Extended key usage flags"
      @subText="These flags enable common extended key usages. They are separate from the explicit extended key usage constraints above."
    />
  </div>

  {{#each this.keyUsageFlags as |fieldName|}}
    {{#let (find-by "name" fieldName @form.formFields) as |field|}}
      <FormField data-test-field={{true}} @attr={{field}} @model={{@form}} />
    {{/let}}
  {{/each}}

  <StringList
    class="is-shadowless"
    data-test-input="ext_key_usage_oids"
    @label="Extended key usage OIDs"
    @inputValue={{get @form.data "ext_key_usage_oids"}}
    @onChange={{this.onStringListChange}}
    @attrName="ext_key_usage_oids"
    @subText="A list of extended key usage OIDs. Add one item per row."
  />
</div>